package com.klw.business.service.impl;

import java.util.List;
import com.klw.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.klw.business.mapper.KlwDepartmentMapper;
import com.klw.business.domain.KlwDepartment;
import com.klw.business.service.IKlwDepartmentService;

/**
 * 院系Service业务层处理
 * 
 * @author klw
 * @date 2025-08-24
 */
@Service
public class KlwDepartmentServiceImpl implements IKlwDepartmentService 
{
    @Autowired
    private KlwDepartmentMapper klwDepartmentMapper;

    /**
     * 查询院系
     * 
     * @param departmentId 院系主键
     * @return 院系
     */
    @Override
    public KlwDepartment selectKlwDepartmentByDepartmentId(Long departmentId)
    {
        return klwDepartmentMapper.selectKlwDepartmentByDepartmentId(departmentId);
    }

    /**
     * 查询院系列表
     * 
     * @param klwDepartment 院系
     * @return 院系
     */
    @Override
    public List<KlwDepartment> selectKlwDepartmentList(KlwDepartment klwDepartment)
    {
        return klwDepartmentMapper.selectKlwDepartmentList(klwDepartment);
    }

    /**
     * 新增院系
     * 
     * @param klwDepartment 院系
     * @return 结果
     */
    @Override
    public int insertKlwDepartment(KlwDepartment klwDepartment)
    {
        klwDepartment.setCreateTime(DateUtils.getNowDate());
        return klwDepartmentMapper.insertKlwDepartment(klwDepartment);
    }

    /**
     * 修改院系
     * 
     * @param klwDepartment 院系
     * @return 结果
     */
    @Override
    public int updateKlwDepartment(KlwDepartment klwDepartment)
    {
        klwDepartment.setUpdateTime(DateUtils.getNowDate());
        return klwDepartmentMapper.updateKlwDepartment(klwDepartment);
    }

    /**
     * 批量删除院系
     * 
     * @param departmentIds 需要删除的院系主键
     * @return 结果
     */
    @Override
    public int deleteKlwDepartmentByDepartmentIds(Long[] departmentIds)
    {
        return klwDepartmentMapper.deleteKlwDepartmentByDepartmentIds(departmentIds);
    }

    /**
     * 删除院系信息
     * 
     * @param departmentId 院系主键
     * @return 结果
     */
    @Override
    public int deleteKlwDepartmentByDepartmentId(Long departmentId)
    {
        return klwDepartmentMapper.deleteKlwDepartmentByDepartmentId(departmentId);
    }
}
